package com.hj.server.pojo;

import java.time.LocalDateTime;
import java.util.Objects;

public class ChatMsg {

    private String from;
    private String to;
    private String content;
    private LocalDateTime date;
    private String fromNickname;

    public ChatMsg() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ChatMsg chatMsg = (ChatMsg) o;
        return Objects.equals(from, chatMsg.from) &&
                Objects.equals(to, chatMsg.to) &&
                Objects.equals(content, chatMsg.content) &&
                Objects.equals(date, chatMsg.date) &&
                Objects.equals(fromNickname, chatMsg.fromNickname);
    }

    @Override
    public int hashCode() {

        return Objects.hash(from, to, content, date, fromNickname);
    }

    @Override
    public String toString() {
        return "ChatMsg{" +
                "from='" + from + '\'' +
                ", to='" + to + '\'' +
                ", content='" + content + '\'' +
                ", date=" + date +
                ", fromNickname='" + fromNickname + '\'' +
                '}';
    }

    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getTo() {
        return to;
    }

    public void setTo(String to) {
        this.to = to;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public LocalDateTime getDate() {
        return date;
    }

    public void setDate(LocalDateTime date) {
        this.date = date;
    }

    public String getFromNickname() {
        return fromNickname;
    }

    public void setFromNickname(String fromNickname) {
        this.fromNickname = fromNickname;
    }

    public ChatMsg(String from, String to, String content, LocalDateTime date, String fromNickname) {

        this.from = from;
        this.to = to;
        this.content = content;
        this.date = date;
        this.fromNickname = fromNickname;
    }
}
